package com.sec.samsung.android.app.baymax.model;

import java.util.ArrayList;

import com.sec.samsung.android.app.baymax.utils.BaymaxConstant;
import com.sec.samsung.android.app.baymax.utils.StringUtility;

/**
 * @author khacpham (khac.pvan@samsung.com)
 * @serial client-server
 * */
public class Question {
    public static final String TYPE_YES_NO = "yes_no";
    public static final String TYPE_SELECT_MULTI = "select_multi";
    public static final String TYPE_SELECT_SINGLE = "select_single";

    /**
     * @value question id
     * */
    private String id;
    /**
     * @value question type (yesno/multi/single)
     * */
    private String type;
    /**
     * @value the question (ex: "are your sick?")
     * */
    private String question;
    /**
     * @value answer from client. Retrieve from client.
     * */
    private ArrayList<String> answers;

    private String answer1, answer2, answer3, answer4, answer5, answer6;

    public Question() {
        answers = new ArrayList<String>();
    }

    public Question(String id, String type, String question, String answer1, String answer2, String answer3, String answer4, String answer5, String answer6) {
        super();
        this.id = id;
        this.type = type;
        this.question = question;
        this.answer1 = answer1;
        this.answer2 = answer2;
        this.answer3 = answer3;
        this.answer4 = answer4;
        this.answer5 = answer5;
        this.answer6 = answer6;
    }

    public Question(String id, String type, String question, ArrayList<String> answers) {
        super();
        this.id = id;
        this.type = type;
        this.question = question;
        this.answers = answers;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    public ArrayList<String> getAnswers() {
        return answers;
    }

    public void setAnswers(ArrayList<String> answers) {
        this.answers = answers;
    }

    public String getAnswer1() {
        return answer1;
    }

    public void setAnswer1(String answer1) {
        this.answer1 = answer1;
    }

    public String getAnswer2() {
        return answer2;
    }

    public void setAnswer2(String answer2) {
        this.answer2 = answer2;
    }

    public String getAnswer3() {
        return answer3;
    }

    public void setAnswer3(String answer3) {
        this.answer3 = answer3;
    }

    public String getAnswer4() {
        return answer4;
    }

    public void setAnswer4(String answer4) {
        this.answer4 = answer4;
    }

    public String getAnswer5() {
        return answer5;
    }

    public void setAnswer5(String answer5) {
        this.answer5 = answer5;
    }

    public String getAnswer6() {
        return answer6;
    }

    public void setAnswer6(String answer6) {
        this.answer6 = answer6;
    }

    @Override
    public String toString() {
        return "Question [id=" + id + ", type=" + type + ", question=" + question + ", answers=" + answers + ", answer1=" + answer1 + ", answer2=" + answer2 + ", answer3=" + answer3 + ", answer4=" + answer4 + ", answer5=" + answer5 + ", answer6=" + answer6 + "]";
    }

    public boolean isCheckImageQuestion() {
        if (!StringUtility.isEmpty(answer1) && answer1.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        if (!StringUtility.isEmpty(answer2) && answer2.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        if (!StringUtility.isEmpty(answer3) && answer3.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        if (!StringUtility.isEmpty(answer4) && answer4.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        if (!StringUtility.isEmpty(answer5) && answer5.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        if (!StringUtility.isEmpty(answer6) && answer6.startsWith(BaymaxConstant.IMAGE_TYPE))
            return true;
        return false;
    }
}
